package com.hxut.controller;

import cn.hutool.extra.servlet.ServletUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hxut.service.*;
import com.hxut.utils.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.ServletRequestUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * description: BaseController
 * date: 2022/6/21 8:39
 * author: MR.孙
 */
public class BaseController {
    @Autowired
    HttpServletRequest req;

    @Autowired
    RedisUtils redisUtils;

    @Autowired
    SysUserService sysUserService;

    @Autowired
    SysRoleService sysRoleService;

    @Autowired
    SysMenuService sysMenuService;

    @Autowired
    SysUserRoleService sysUserRoleService;

    @Autowired
    SysRoleMenuService sysRoleMenuService;

    /**
     * @description:  获取分页
     * @return: com.baomidou.mybatisplus.extension.plugins.pagination.Page
     * @author: MR.孙
     * @date: 2022/7/12 9:43
    */
    public Page getPage(){
        int current= ServletRequestUtils.getIntParameter(req,"current",0);
        int size = ServletRequestUtils.getIntParameter(req,"page",10);
        return new Page(current,size);
    }
}